package com.todo.strategy.online.application.frontend.controller;

import com.todo.common.common.entity.response.BizResponse;
import com.todo.strategy.online.application.frontend.service.TravelStrategyDateAggService;
import com.todo.strategy.online.iface.TravelStrategyDateFrontendIface;
import com.todo.strategy.online.iface.request.TravelSimpleDateByUserParam;
import com.todo.strategy.online.iface.response.TravelSimpleDateVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author azhebuxing
 * @date 2024/5/21 14:24
 * @description
 */
@Slf4j
@RestController
@RequestMapping("/strategy")
@Tag(name = "攻略数据前台接口", description = "攻略数据前台接口")
public class TravelStrategyDateFrontendController implements TravelStrategyDateFrontendIface {

    @Resource
    private TravelStrategyDateAggService travelStrategyDateAggService;

    @Override
    @Operation(summary = "查询用户旅行日期信息")
    @PostMapping("/queryTravelSimpleDateByUser")
    public BizResponse<TravelSimpleDateVO> queryTravelSimpleDateByUser(TravelSimpleDateByUserParam param) {
        if (param == null) {
            return BizResponse.success("查询异常，请刷新后重新操作");
        }
        if (!param.baseCheck()) {
            return BizResponse.success("查询失败，请刷新后重新操作");
        }
        return travelStrategyDateAggService.queryTravelSimpleDateByUser(param);
    }
}
